#ifndef _LOGGING_H_
#define _LOGGING_H_

#include <stdarg.h>

#define LOG_LABEL_SIZE	64
#define LOG_BUFFER_SIZE	1024
#define LOG_PATH_SIZE	128

#define LV_FATAL	0	/* system is unusable */
#define LV_ERROR	1	/* error conditions */
#define LV_SYS		2	/* system info */
#define LV_WARN		3	/* warning conditions */
#define LV_INFO		4	/* informational message */
#define LV_DEBUG	5	/* debug level message */
#define LV_NUMS		6

typedef struct LOGGING {
	unsigned int	level;
	unsigned int	bufsz;
	int				fd;
	char			path[LOG_PATH_SIZE];
} LOGGING;

LOGGING * logging_new(const char * path, unsigned int level, unsigned int bufsz);
int logging_free(LOGGING * p);

//level ok return 1 else return 0
int lvok(LOGGING * p, unsigned int level);
//logit to users
void logit(LOGGING * p, unsigned int level, const char *fmt, ...);
//raw logit with msg and no level check
void rlogit(LOGGING * p, unsigned int level, const char * msg);
//va_list logit with fmt args and no level check
void vlogit(LOGGING * p, unsigned int level, const char * fmt, va_list argp);

#endif
